package com.lc.pianostudent.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2018/2/22.
 */
@HttpInlet(Conn.GETUSER)
public class PostGetuser extends BaseAsyPost {

    public String user_id, type;
    public PostGetuser(AsyCallBack asyCallBack) {
        super(asyCallBack);
    }

    @Override
    protected PostGetuserInfo parser(JSONObject object) throws Exception {
        if (object.optString("code").equals("200")) {

            PostGetuserInfo info = new PostGetuserInfo();

            info.code = object.optString("code");
            info.message = object.optString("message");

            JSONObject jsonObject = object.optJSONObject("data");
            info.cname = jsonObject.optString("cname");
            info.sex = jsonObject.optString("sex");
            info.year = jsonObject.optString("year");
            info.avatar = jsonObject.optString("avatar");
            info.mouse = jsonObject.optString("mouse");
            info.name = jsonObject.optString("name");
            info.person = jsonObject.optString("person");

            TOAST = object.optString("message");
            return info;

        } else {

            TOAST = object.optString("message");

        }

        return null;
    }

    public static class PostGetuserInfo {

        public String code, message,avatar,cname,sex,year,mouse,name,person;


    }

}
